<template>
  <div class="toolbar">
    <el-dropdown @command="handleCommand">
    <span class="el-dropdown-link">
      <el-image
          style="width: 50px;height: 50px;margin-top: 35px"
          src="http://img.linzhongyue.cn/48d770d6824e43a2abf373142eba60d4.jpg"
      />
      <el-icon style="margin-left: 5px"><CaretBottom /></el-icon>
    </span>
      <template #dropdown>
        <el-dropdown-menu>
          <el-dropdown-item command="a">门户页面</el-dropdown-item>
          <el-dropdown-item command="b">修改信息</el-dropdown-item>
          <el-dropdown-item command="c" divided>退出</el-dropdown-item>
        </el-dropdown-menu>
      </template>
    </el-dropdown>
  </div>
</template>

<script lang="ts" setup>
import {CaretBottom} from '@element-plus/icons-vue'
import router from "../../../router";
import {ElNotification} from "element-plus";

const handleCommand = (command: string | number | object) => {
  if(command == 'a'){
    window.open("http://101.35.239.17");
  }

  if(command == 'b'){
    router.push('/system/editUser')
  }

  if(command == 'c'){
    sessionStorage.removeItem("TOKEN") // 部署云服务器后失效
    router.push("/login")
  }
}
</script>

<style scoped lang="scss">
.toolbar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  right: 20px;
}

.example-showcase .el-dropdown-link {
  cursor: pointer;
  color: var(--el-color-primary);
  display: flex;
  align-items: center;
}
</style>
